#ifndef __DEBUG_H__
#define __DEBUG_H__

/**
 *  debug.h
 *  dulezite veci pro debugovani
 */

#include <kprintf.h>

/**
 *  dumpregs()
 *  vypise aktualni obsah vsech registru na monitor
 *  (kazdy registr na novy radek)
 */
#define dumpregs()    kprintf("AX:0x%x\n" \
                              "BX:0x%x\n" \
                              "CX:0x%x\n" \
                              "DX:0x%x\n" \
                              "CS:0x%x\n" \
                              "DS:0x%x\n" \
                              "ES:0x%x\n" \
                              "SS:0x%x\n" \
                              "SP:0x%x\n" \
                              "SI:0x%x\n" \
                              "DI:0x%x\n" \
                              "BP:0x%x\n", \
                              _AX, _BX, _CX, _DX, _CS, _DS, _ES, _SS, _SP, _SI, _DI, _BP)

/**
 *  l_dumpregs()
 *  vypise aktualni obsah vsech registru na monitor
 *  (oddelene strednikem)
 */
#define l_dumpregs()  kprintf("AX:0x%x;" \
                              "BX:0x%x;" \
                              "CX:0x%x;" \
                              "DX:0x%x;" \
                              "CS:0x%x;" \
                              "DS:0x%x;" \
                              "ES:0x%x;" \
                              "SS:0x%x;" \
                              "SP:0x%x;" \
                              "SI:0x%x;" \
                              "DI:0x%x;" \
                              "BP:0x%x;", \
                              _AX, _BX, _CX, _DX, _CS, _DS, _ES, _SS, _SP, _SI, _DI, _BP)

/**
 *  dumpptr(ptr)
 *  vypise na monitor ukazatel ve tvaru [xxxx:yyyy],
 *  kde "xxxx" je segment a "yyyy" je ofset
 */
#define dumpptr(ptr)  kprintf("[%04x:%04x]", (int)((long)(ptr) >> 16), (int)ptr)

#endif
